﻿<script src="~/Scripts/jquery-easyui-extensions/combo/jeasyui.extensions.combo.setIcon.js"></script>

<div class="easyui-panel" data-options="fit:true,border:false" style="padding:20px;">
    <select id="cc" style="width:150px"></select>
    <div id="sp">
        <div style="color:#99BBE8;background:#fafafa;padding:5px;">Select a language</div>
        <div style="padding:10px">
            <input type="radio" name="lang" value="01"><span>Java</span><br />
            <input type="radio" name="lang" value="02"><span>C#</span><br />
            <input type="radio" name="lang" value="03"><span>Ruby</span><br />
            <input type="radio" name="lang" value="04"><span>Basic</span><br />
            <input type="radio" name="lang" value="05"><span>Fortran</span>
        </div>
    </div>
    <br />
    <br />
    <input id="iconValue" type="text" value="icon-edit" /> &nbsp;<span style="color:red;">请自行输入要设置给上述 combo 的图标样式</span>
    <br />
    <a id="btnSet" class="easyui-linkbutton" data-options="iconCls:'icon-edit'">设置新图标</a>
</div>

<script>
    $(function () {
        $('#cc').combo({
            editable: false,
            iconCls: 'icon-save'
        });
        $('#sp').appendTo($('#cc').combo('panel'));
        $('#sp input').click(function () {
            var v = $(this).val();
            var s = $(this).next('span').text();
            $('#cc').combo('setValue', v).combo('setText', s).combo('hidePanel');
        });


        $("#btnSet").click(function () {
            var value = $("#iconValue").val();
            if ($.string.isNullOrWhiteSpace(value)) { return; }

            $('#cc').combo("setIcon", value);
        });
    });
</script>